// let xmap = new Map()
// xmap.set('','')
// xmap.set('','')
// xmap.set('','')
// console.log(xmap);
// console.log(xmap.size);  
// console.log(xmap.get(''));
// for(let [key,value] of xmap){
//     console.log(`${key}--->${value}`);
// } 


let sentence = 'this is a book that is a desk'
let words = sentence.split(' ')
// console.log(words);

let word_map = new Map()
for(let word of words){
    if(word_map.has(word)){
        let count = word_map.get(word)
        count++
        word_map.set(word,count)
    }
    else{
        word_map.set(word,1)
    }
}
for(let [key,value] of word_map){
    console.log(`${key}--->${value}`);
} 
console.log([...word_map.keys()]);
console.log([...word_map.values()]);

